$(function(){
		//对点击查找最新
			$("#fillmoreright1_contents_button1").click(function(){
				$(this).css("backgroundColor","#000");
				$(this).css("color","#fff");
				$("#fillmoreright1_contents_button2").css("color","#000");
				$("#fillmoreright1_contents_button2").css("backgroundColor","#fff");
				$("#fillmoreright1_contents_newest").css("display","block");
				$("#fillmoreright1_contents_hottest").css("display","none");
			});
			//对点击查找最热
			$("#fillmoreright1_contents_button2").click(function(){
				$(this).css("backgroundColor","#000");
				$(this).css("color","#fff");
				$("#fillmoreright1_contents_button1").css("color","#000");
				$("#fillmoreright1_contents_button1").css("backgroundColor","#fff");
				$("#fillmoreright1_contents_newest").css("display","none");
				$("#fillmoreright1_contents_hottest").css("display","block");
			});
	//对于心情的推荐
			$(".fillmorerights2_div1_a1").click(function(){
				$(".fillmoreright1").css("display","none");
				$("#fillmorerights2_div1_div1").animate({width:'400px'},30).css("display","block");	
			});
			$(".fillmorerights2_div1_a2").click(function(){
				$(".fillmoreright1").css("display","none");
				$("#fillmorerights2_div1_div2").animate({width:'400px'},30).css("display","block");	
			});
			$(".fillmorerights2_div1_a3").click(function(){
				$(".fillmoreright1").css("display","none");
				$("#fillmorerights2_div1_div3").animate({width:'400px'},30).css("display","block");	
			});
			$(".fillmorerights2_div1_a4").click(function(){
				$(".fillmoreright1").css("display","none");
				$("#fillmorerights2_div1_div4").animate({width:'400px'},30).css("display","block");	
			});
			$(".fillmorerights2_div1_a5").click(function(){
				$(".fillmoreright1").css("display","none");
				$("#fillmorerights2_div1_div5").animate({width:'400px'},30).css("display","block");	
			});
			$(".fillmorerights2_div1_a6").click(function(){
				$(".fillmoreright1").css("display","none");
				$("#fillmorerights2_div1_div6").animate({width:'400px'},30).css("display","block");	
			});	
		//对于轻音乐
			$(".fillmorerights3_div1_a1").click(function(){
				$(".fillmoreright1").css("display","none");
				$("#fillmorerights3_div1_div1").animate({width:'400px'},30).css("display","block");	
			});
			$(".fillmorerights3_div1_a2").click(function(){
				$(".fillmoreright1").css("display","none");
				$("#fillmorerights3_div1_div2").animate({width:'400px'},30).css("display","block");	
			});
			$(".fillmorerights3_div1_a3").click(function(){
				$(".fillmoreright1").css("display","none");
				$("#fillmorerights3_div1_div3").animate({width:'400px'},30).css("display","block");	
			});
			$(".fillmorerights3_div1_a4").click(function(){
				$(".fillmoreright1").css("display","none");
				$("#fillmorerights3_div1_div4").animate({width:'400px'},30).css("display","block");	
			});
			$(".fillmorerights3_div1_a5").click(function(){
				$(".fillmoreright1").css("display","none");
				$("#fillmorerights3_div1_div5").animate({width:'400px'},30).css("display","block");	
			});
			$(".fillmorerights3_div1_a6").click(function(){
				$(".fillmoreright1").css("display","none");
				$("#fillmorerights3_div1_div6").animate({width:'400px'},30).css("display","block");	
			});	
			
			$("#fillmorerights_contents_button2").bind("click",function(){
		$("#fillmorerights_contents_textarea").val("");
		$("#fillmorerights_contents_span").text("200");
	});
});



//返回
function Return()
{
	$(".fillmorerights2_div1_class").css("display","none");
	$("#fillmorerights2").animate({width:'400px'},30).css("display","block");
}
function Returns()
{
	$(".fillmorerights3_div1_class").css("display","none");
	$("#fillmorerights3").animate({width:'400px'},30).css("display","block");
}

//查看结果
	function replace_em(str){
		str = str.replace(/\</g,'&lt;');
		str = str.replace(/\>/g,'&gt;');
		str = str.replace(/\n/g,'<br/>');
		str = str.replace(/\[em_([0-9]*)\]/g,'<img src="arclist/$1.gif" border="0" />');
		return str;
	}
//转换图片
function show(){
	$(".mentailtys_1").html(content);
}
/*
//对于用户点击音频的处理
function getData(id){
	$.post("../fmArticleServlet?t="+new Date(),{op:"getData",music:id},function(data){
         // window.location.reload(); //重定后 再刷新页面 
		location.href="FM_mentality.jsp";
	});
}
//对于用户点击轻音乐的处理
function getDatas(id){
	$.post("../fmArticleServlet?t="+new Date(),{op:"getDatas",music:id},function(data){
        // window.location.reload(); //重定后 再刷新页面 
		location.href="FM_mentalitys.jsp";
	});
}

//对于留言
function Notes(){
	var date=new Date();
	var ctime=currentTime();//获取当前时间
	contents=replace_em($("#fillmorerights6_contents_textarea").val());
	if(contents!=""){
		$.post("../fmArticleServlet?t="+new Date(),{op:"Notes",content:contents,ctime:ctime},function(data){
			if(data==0){
				$(".log_user").css("display","block");
				$(".log_user_info").css("display","block");
			}else {
				var str="";
				$.each(data.Note,function(index,item){
					str+='<li style="border-bottom:1px #E1E1E1 dashed"><a class="FM_img"><img src="../images/userlogin.jpg"/></a><div class="mentality_div"><a>用户'+item.w_uid+'</a><br/><a>'+item.ccontent+'</a><p>'+item.ctime.substring(0,item.ctime.length-2)+'</p></div></li>';
				});
				$("#fillmorerights6_contents_ul").html(str);
				$("#fillmorerights6_contents_textarea").val("");  //清空本身的内容
			}
		},"json");
	}
	
}

//对于文章登录后用户评论
function content(id){
		var date=new Date();
		var ctime=currentTime();//获取当前时间
		contents=replace_em($("#fillmorerights_contents_textarea").val());
		if(contents!=""){
			$.post("../fmArticleServlet?t="+new Date(),{op:"FMcontents",content:contents,id:id,ctime:ctime},function(data){
				if(data==0){
					$(".log_user").css("display","block");
					$(".log_user_info").css("display","block");
				}else {
					var str="";
					$.each(data.rows,function(index,item){
						str+='<li style="border-bottom:1px #E1E1E1 dashed"><a class="FM_img"><img src="../images/userlogin.jpg"/></a><div class="mentality_div"><a>用户'+item.w_uid+'</a><br/><a>'+item.ccontent+'</a><p>'+item.ctime.substring(0,item.ctime.length-2)+'</p></div></li>';
					});
					$("#fillmorerights_contents_ul").html(str);
					$("#fillmorerights_contents_textarea").val("");  //清空本身的内容
				}
			},"json");
		}
}

//对于轻音乐 登录后用户评论
function contentMusic(id){
		var date=new Date();
		var ctime=currentTime();//获取当前时间
		contents=replace_em($("#fillmorerights_contents_textarea").val());
		if(contents!=""){
			$.post("../fmArticleServlet?t="+new Date(),{op:"FMcontentsMusic",content:contents,id:id,ctime:ctime},function(data){
				if(data==0){
					$(".log_user").css("display","block");
					$(".log_user_info").css("display","block");
				}else {
					var str="";
					$("#fillmorerights_contents_ul li").html("");
					$.each(data.row,function(index,item){
						str+='<li style="border-bottom:1px #E1E1E1 dashed"><a class="FM_img"><img src="../images/userlogin.jpg"/></a><div class="mentality_div"><a>用户'+item.w_uid+'</a><br/><a>'+item.ccontent+'</a><p>'+item.ctime.substring(0,item.ctime.length-2)+'</p></div></li>';
					});	
				}
				$("#fillmorerights_contents_ul").html(str);
				$("#fillmorerights_contents_textarea").val("");  //清空本身的内容
			},"json");
		}
}
//对待搜索
function Search(){
	var text=$.trim($("#fillmoreright1_fillmorerights4_div .text").val());   
	text=text.replace(/\s+/g,""); //去掉中间的空格
	var type=$('input:radio[name="FMtype"]:checked').val();
	var str="";
	/*$.post("../fmArticleServlet?t="+new Date(),{op:"Search",text:text,type:type},function(data){
		$.each(data.rows,function(index,item){
			str+='<li><a href="javaScript:getData('+item.fid+')" class="fillmoreright1_contents_img"><img  src="../'+item.faddr+'"/>';
			str+='</a><div ><a href="javaScript:getData('+item.fid+')"><span style="color:#000">'+item.fname+'</span></a><br/>';
            str=str+'<span>作者：'+item.fauthor+'</span><br/><span>播出时间：'+item.ftime+'<span></div></li>';
		});
		$("#FmDim").html(str);
	},"json");
	$.ajax({
		type: "post",
		url: "../fmArticleServlet?op=Search",
		dataType:'json',
		data:{
			text : text,
			type :type
		},
		success:function(data){
			if(!data.rows){
				str="<a style='margin-left:80px;display:block;margin-top:200px;font-size:20px;'>亲！小微没找到你想要的音频</a>";
				$("#fillmorerights4 .fillmoreright1_contents").html(str);
			}else{
			var str="";
				$.each(data.rows,function(index,item){
					if(item.fid==undefined){
						str+='<li><a href="javaScript:getData('+item.mid+')" class="fillmoreright1_contents_img"><img  src="../'+item.maddr+'"/>';
						str+='</a><div ><a href="javaScript:getData('+item.mid+')"><span style="color:#000">'+item.mname+'</span></a><br/>';
				        str=str+'<span>作者：'+item.mauthor+'</span><br/><span>播出时间：'+item.mtime+'<span></div></li>';
					}else
					{
						str+='<li><a href="javaScript:getData('+item.fid+')" class="fillmoreright1_contents_img"><img  src="../'+item.faddr+'"/>';
						str+='</a><div ><a href="javaScript:getData('+item.fid+')"><span style="color:#000">'+item.fname+'</span></a><br/>';
						str=str+'<span>作者：'+item.fauthor+'</span><br/><span>播出时间：'+item.ftime+'<span></div></li>';
					}
				});
				$("#FmDim").html(str);
			}
		}
	});
	$("#fillmoreright1_fillmorerights4_div .text").val("");
}*/

/*当前时间*/
function currentTime(){
	var d=new Date();
	var h=d.getHours().toString();
	var m=d.getMinutes().toString();
	var s=d.getSeconds().toString();
	if(h.length<2){
		h="0"+h;
	}
	if(m.length<2){
		m="0"+m;
	}
	if(s.length<2){
		s="0"+s;
	}
	var time=d.getFullYear()+"-"+(d.getMonth()+1)+"-"+d.getDate()+" "+h+":"+m+s;
	return time;
}
